package com.fary.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fary.base.BaseMapper;
import com.fary.po.CornTask;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface CornTaskMapper extends BaseMapper<CornTask> {

    /**
     * 获取所有定时任务 (包括 启动和未启动的)
     */
    default List<CornTask> getAllCornsList() {
        LambdaQueryWrapper<CornTask> queryWrapper = new LambdaQueryWrapper<CornTask>()
                .orderByAsc(CornTask::getCornid);
        return selectList(queryWrapper);
    }

    /**
     * 获取所有定时任务 (包括 启动)
     */
    default List<CornTask> getAllEnableCornsList() {
        LambdaQueryWrapper<CornTask> queryWrapper = new LambdaQueryWrapper<CornTask>()
                .eq(CornTask::getEnable, "T")
                .orderByAsc(CornTask::getCornid);
        return selectList(queryWrapper);
    }
}
